<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>2-本地存储localStorage(二)</title>
</head>
<body>
    <script>
        //1.容量大于sessionStorage
        //2.可将对象类型的转为字符串存储
        //3.生命周期，关闭浏览器之后还存在，多个窗口可共享

        //存值
        localStorage.setItem('uid',100);
        localStorage.setItem('avatar','https://www.baidu.com/2.png');

        //取值
        let uid = localStorage.getItem('uid');
        let avatar = localStorage.getItem('avatar');
        console.log(uid);
        console.log(avatar);

        //删除
        localStorage.removeItem('uid');
        localStorage.removeItem('avatar');

        //清空
        //localStorage.clear();


        //localStorage.setItem('uname','cms');





    </script>
</body>
</html>